package com.freedom.auth.service.impl;

import com.freedom.auth.domain.Role;
import com.freedom.auth.dto.RoleDTO;
import com.freedom.auth.mapper.RoleMapper;
import com.freedom.auth.service.IRoleService;
import com.freedom.base.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author freedom
 * @since 2023-10-13
 */
@Service
@Transactional(propagation = Propagation.SUPPORTS,readOnly = true)
public class RoleServiceImpl extends BaseServiceImpl<Role> implements IRoleService {
    @Autowired
    private RoleMapper mapper;

    @Override
    public List<Long> getRolePermissionIds ( Long id ) {

        return mapper.getRolePermissionIds(id);
    }

    @Transactional
    @Override
    public void getRoleAuth ( RoleDTO roleDTO ) {
        mapper.clear();
        mapper.getRoleAuth(roleDTO);
    }
}
